package com.ylfstu.homework;

public class Homework04 {
    public static void main(String[] args) {
        String string = "qwerASDF1234";
        countString(string);
    }
    public static void countString(String string) {

        int number = 0;
        int upperCase = 0;
        int lowerCase = 0;
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) >= 'A' && string.charAt(i) <= 'Z') {
                upperCase++;
            } else if (string.charAt(i) >= 'a' && string.charAt(i) <= 'z') {
                lowerCase++;
            } else if (string.charAt(i) >= '0' && string.charAt(i) <= '9') {
                number++;
            }
        }

//        char[] chars = string.toCharArray();
//        int number = 0;
//        int upperCase = 0;
//        int lowerCase = 0;
//        for (int i = 0; i < chars.length; i++) {
//            if (chars[i] >= 'A' && chars[i] <= 'Z') {
//                upperCase += 1;
//            } else if (chars[i] >= 'a' && chars[i] <= 'z') {
//                lowerCase += 1;
//            } else if (chars[i] >= '0' && chars[i] <= '9') {
//                number += 1;
//            }
//        }
        System.out.println("大写字母个数：" + number);
        System.out.println("小写字母个数：" + upperCase);
        System.out.println("数字个数：" + lowerCase);
    }
}
